﻿package rob.data{

	public class RGB{
		public var r:Number, g:Number, b:Number;
		
		public function RGB(ir:Number,ig:Number,ib:Number):void{
			r = ir;
			g = ig;
			b = ib;
		}
		
		public static function rgbToHex(c:RGB):Number{
			return c.r << 16 | c.g << 8 | c.b;
		}
		
		public static function grayscale(k:Number):Number{
			//k *= .2;
			k = k & 0xFF;
			return k << 16 | k << 8 | k;
		}
		
		public static function redscale(k:Number):Number{
			k = k & 0xFF;
			return k << 16 | 0 << 8 | 0;
		}
		
		public function toString():String{
			return "RGB: ("+r+","+g+","+b+")";
		}
	}
}